var app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: null,
    schoolInform: null,
    testInform: null,
    contentInform: null,
    indicatorDots: true,
    autoplay: true,
    circular: true,
    interval: 5000,
    duration: 1000,
    schoolName: null,
    id: 0
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    var that = this
    wx.request({
      url: 'http://xxxxx:8080/webchat/index/querylatestinfo',
      data: {
        shoolId: app.globalData.userInfo.schoolid
      },
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: res => {
        console.log(res.data)
        that.setData({
          imgUrls: res.data.data.pictures,
          schoolName: app.globalData.userInfo.schoolname,
          schoolInform: res.data.data.message.schoolInform,
          testInform: res.data.data.message.testInform,
          contentInform: res.data.data.message.contentInform
        })

        console.log(this.data.schoolInform)


        // that.data.schoolInform = res.data.data,message.schoolInform;
        // that.data.testInform = res.data.data.message.testInform;
        // that.data.contentInform = res.data.data.message.contentInform;
      }
    })

  },

  broadcast: function() {
    console.log("点击广播成功了")
    wx.navigateTo({
      url: '../broadcast/broadcast',
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  schoolInfo: function() {
    console.log("点击学校通知成功了")
    wx.navigateTo({
      url: '../schoolinfo/schoolinfo',
    })
  },
  testInfo: function() {
    console.log("点击考试成功了")
    wx.navigateTo({
      url: '../testinfo/testinfo',
    })
  },
  contentInfo: function() {
    console.log("点击竞赛成功了")
    wx.navigateTo({
      url: '../contentinfo/contentinfo',
    })
  },


  onClickschooolInfo: function() {
    var that = this;
    that.setData({
      id: that.data.schoolInform.id
    })
    wx.navigateTo({
      url: '../content/content?id='+that.data.id,
    })
  },
  onClicktestInfo: function() {
    var that = this;
    that.setData({
      id: that.data.testInform.id
    })
    wx.navigateTo({
      url: '../content/content?id=' + that.data.id,
    })
  },
  onClickcontentInfo: function() {
    var that = this;
    that.setData({
      id: that.data.contentInform.id
    })
    wx.navigateTo({
      url: '../content/content?id=' + that.data.id,
    })
  }
})